package service;

import dao.PetDao;
import dao.PetDaoOracleImpl;
import entity.pet;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.Time;

@Service("PetServiceImpl")
public class PetServiceImpl implements PetService {
    @Autowired
    private PetDao petDao;
    @Override
    public boolean save(pet pet) {
        int rows= petDao.insert(pet);
        delay(3000);
        return rows>0;
    }

    @Override
    public boolean modify(pet pet) {
        delay(2000);
        return false;
    }

    @Override
    public boolean del(Integer id) {
        delay(1000);
        return false;
    }
    private void delay(int time) {
        try {
            Thread.sleep(time);
        }catch (InterruptedException e){
            e.printStackTrace();
        }
    }
}